/*
 * @Description:
 * @Author: fhw
 * @Date: 2023-02-21 20:39:33
 */
import { ApiProperty } from '@nestjs/swagger';
import { BaseEntity, PaginatedResult } from 'src/common/entities/entities';
import {
    Entity,
    Column,
    OneToMany,
    ManyToOne,
    JoinColumn,
} from 'typeorm';
export const MenuButtonFieldName = {
    key: '按钮key',
    name: '按钮名称',
    menuId: '菜单ID',
}
import { MenuEntity } from './menu.entity';
@Entity({ name: 'menu-button' })
export class MenuButtonEntity extends BaseEntity {
    /** 按钮key */
    @ApiProperty({ example: 'key', description: '按钮key' })
    @Column({ type: 'varchar', comment: '按钮key', length: 255 })
    key: string;
    /** 按钮名称 */
    @ApiProperty({ example: 'name', description: '按钮名称' })
    @Column({ type: 'varchar', comment: '按钮名称', length: 255 })
    name: string;

    @ApiProperty({ example: 'menuButtonId', description: '菜单ID' })
    @Column({
        type: 'int',
        comment: '菜单ID',
        nullable: true,
    })
    menuId: number
    /** 关联情侣关系表 */
    @ManyToOne(() => MenuEntity, (menu) => menu.menuButton, { nullable: true })
    @JoinColumn({ name: 'menuId' })
    menu: MenuEntity;
}
export class MenuResult extends PaginatedResult {
    @ApiProperty({ example: 'data', description: 'data' })
    data: MenuButtonEntity;
}
